package com.mo.math;

import java.util.Arrays;
import java.util.Random;

/**
 * @ClassName EqualsTest
 * @Description TODO
 * @Author Administrator
 * @Date 2021/8/3
 * @Version 1.0
 */
public class EqualsTest {
    public static void main(String[] args) {
        while (true) {
            int[] arr = new int[16];
            int sum = 0;
            for (int i = 0; i < 16; i++) {
                arr[i] = new Random(0).nextInt(9);
                sum += arr[i];
            }
            int a = arr[0] + arr[1] + arr[2] + arr[3];
            int b = arr[4] + arr[5] + arr[6] + arr[7];
            int c = arr[8] + arr[9] + arr[10] + arr[11];
            int d = arr[12] + arr[13] + arr[14] + arr[15];
            int e = arr[0] + arr[4] + arr[8] + arr[12];
            int f = arr[1] + arr[5] + arr[9] + arr[13];
            int g = arr[2] + arr[6] + arr[10] + arr[14];
            int h = arr[3] + arr[7] + arr[11] + arr[15];
            if (18 == a && a == b && b == c && c == d &&
                    d == e && e == f && f == g && g == h && arr[1] != sum / 16) {
                System.out.println(Arrays.toString(arr));
                break;
            }
        }

    }
}
